﻿Sys.Application.add_navigate(onNavigate);

function button_click(buttonNumber) {
    //historyPoint is our "State" bag
    var historyPoint = { pageState: buttonNumber, someOtherValue: 'myValue' };
    var title = String.format("You Clicked Button {0}", buttonNumber);

    //adding a history point will trigger the navigate event
    //wired up from the Sys.Application
    Sys.Application.addHistoryPoint(historyPoint, title);
    document.title = title;
}

function onNavigate(sender, args) {
    var buttonNumber = args.get_state().pageState || "";
    var title = String.format("You Clicked Button {0}", buttonNumber);
    $get("results").innerHTML = title
}
